<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListFormaPagamentoTitle}"></h:outputText>
        </ui:define>

        <ui:define name="menuLateral">

            <h:form id="formLateralMenuFormaPagamentoList">
                
            </h:form>

        </ui:define>

        <ui:define name="body">
            <h:form id="formFormaPagamentoList">

                <h:panelGroup id="messagePanel" layout="block">
                    <p:growl/>
                </h:panelGroup>

                <h:panelGroup>
                    <p:dataTable id="tableFormaPagamento" value="#{formaPagamentoController.items}" var="item" 
                                 style="border:solid 1px" emptyMessage="#{bundle.ListFormaPagamentoEmpty}">

                        <f:facet name="header">#{bundle.ListFormaPagamentoTitle}</f:facet>

                        <p:column id="sigla" >
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListFormaPagamentoTitle_sigla}"/>
                            </f:facet>
                            <h:outputText value="#{item.sigla}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListFormaPagamentoTitle_descricao}"/>
                            </f:facet>
                            <h:outputText value="#{item.descricao}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <p:commandButton actionListener="#{formaPagamentoController.prepareCreate}" 
                                                 value="#{bundle.ListFormaPagamentoCreateLink}" 
                                                 update=":formFormaPagamentoCreate:pgFormaPagamentoCreate" 
                                                 oncomplete="dialogFormaPagamentoCreate.show()"/>
                            </f:facet>
                            <p:commandButton actionListener="#{formaPagamentoController.prepareEdit}" 
                                             value="#{bundle.ListFormaPagamentoEditLink}" 
                                             update=":formFormaPagamentoEdit:pgFormaPagamentoEdit" 
                                             oncomplete="dialogFormaPagamentoEdit.show()"/>
                            <p:commandButton actionListener="#{formaPagamentoController.destroy}" 
                                             value="#{bundle.ListFormaPagamentoDestroyLink}" 
                                             update=":formFormaPagamentoList:tableFormaPagamento" ajax="false"/>
                        </p:column>

                    </p:dataTable>
                </h:panelGroup>

            </h:form>

            <h:form id="formFormaPagamentoCreate">

                <p:dialog header="#{bundle.CreateFormaPagamentoTitle}" widgetVar="dialogFormaPagamentoCreate" resizable="false" 
                          modal="true" showEffect="slide">
                    <p:panelGrid id="pgFormaPagamentoCreate" columns="2">
                        <h:outputLabel value="#{bundle.CreateFormaPagamentoLabel_sigla}" for="sigla" />
                        <p:inputText id="sigla" value="#{formaPagamentoController.selected.sigla}" 
                                     title="#{bundle.CreateFormaPagamentoTitle_sigla}" required="true" 
                                     requiredMessage="#{bundle.CreateFormaPagamentoRequiredMessage_sigla}"/>
                        <h:outputLabel value="#{bundle.CreateFormaPagamentoLabel_descricao}" for="descricao" />
                        <p:inputText id="descricao" value="#{formaPagamentoController.selected.descricao}" 
                                     title="#{bundle.CreateFormaPagamentoTitle_descricao}" required="true" 
                                     requiredMessage="#{bundle.CreateFormaPagamentoRequiredMessage_descricao}"/>
                        <p:commandButton actionListener="#{formaPagamentoController.create}" 
                                         update=":formFormaPagamentoList:tableFormaPagamento" 
                                         value="#{bundle.CreateFormaPagamentoSaveLink}" 
                                         oncomplete="#{formaPagamentoController.prepareCreate}" ajax="false" />
                        <p:commandButton value="Limpar" type="reset" 
                                         update=":formFormaPagamentoCreate:pgFormaPagamentoCreate" ajax="false"/>
                    </p:panelGrid>
                </p:dialog>

            </h:form>

            <h:form id="formFormaPagamentoEdit">

                <p:dialog header="#{bundle.EditFormaPagamentoTitle}" widgetVar="dialogFormaPagamentoEdit" resizable="false" 
                          modal="true" showEffect="slide">
                    <p:panelGrid id="pgFormaPagamentoEdit" columns="2">
                        <h:outputLabel value="#{bundle.EditFormaPagamentoLabel_sigla}" for="sigla" />
                        <p:inputText id="sigla" value="#{formaPagamentoController.selected.sigla}" 
                                     title="#{bundle.EditFormaPagamentoTitle_sigla}" required="true" 
                                     requiredMessage="#{bundle.EditFormaPagamentoRequiredMessage_sigla}"/>
                        <h:outputLabel value="#{bundle.EditFormaPagamentoLabel_descricao}" for="descricao" />
                        <p:inputText id="descricao" value="#{formaPagamentoController.selected.descricao}" 
                                     title="#{bundle.EditFormaPagamentoTitle_descricao}" required="true" 
                                     requiredMessage="#{bundle.EditFormaPagamentoRequiredMessage_descricao}"/>
                        <p:commandButton actionListener="#{formaPagamentoController.update}" 
                                         update=":formFormaPagamentoList:tableFormaPagamento" 
                                         value="#{bundle.EditFormaPagamentoSaveLink}" 
                                         oncomplete="dialogFormaPagamentoEdit.hide()" ajax="false" />
                        <p:commandButton value="Cancelar" oncomplete="dialogFormaPagamentoEdit.hide()" 
                                         ajax="false"/>
                    </p:panelGrid>
                </p:dialog>

            </h:form>

        </ui:define>
    </ui:composition>

</html>
